package com.oliver.picturebackendspaceservice.service;



import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.oliver.picturebackendcommon.model.dto.space.SpaceAddRequest;
import com.oliver.picturebackendcommon.model.dto.space.SpaceEditRequest;
import com.oliver.picturebackendcommon.model.dto.space.SpaceQueryRequest;
import com.oliver.picturebackendcommon.model.vo.SpaceVO;
import com.oliver.picturebackendmodel.model.entity.Space;
import com.oliver.picturebackendmodel.model.entity.User;

import javax.servlet.http.HttpServletRequest;
import java.util.List;

/**
* @author snow
* @description 针对表【space(空间)】的数据库操作Service
* @createDate 2024-12-19 21:20:57
*/
public interface SpaceService extends IService<Space> {

    /**
     * 校验空间
     * @param space
     * @param add
     */
    void validSpace(Space space, boolean add);

    /**
     * 根据空间等级，自动填充限额
     * @param space
     */
    void fillSpaceBySpaceLevel(Space space);

    long addSpace(SpaceAddRequest spaceAddRequest, User loginUser);

    /**
     * 通用的分页查询
     * @param request
     * @return
     */
    QueryWrapper<Space> getQueryWrapper(SpaceQueryRequest request);

    /**
     * VO类转换
     * @param space
     * @return
     */
    SpaceVO getSpaceVO(Space space);

    /**
     * VO类的列表转换
     * @param spacePage
     * @param request
     * @return
     */
    Page<SpaceVO> getSpaceVOPage(Page<Space> spacePage, HttpServletRequest request);

    /**
     * 编辑空间
     * @param spaceEditRequest
     * @param loginUser
     */
    void editSpace(SpaceEditRequest spaceEditRequest, User loginUser);

    /**
     * 空间的权限校验
     * @param loginUser
     * @param space
     */
    void checkSpaceAuth(User loginUser, Space space);

    /**
     * 删除空间
     * @param id
     * @param loginUser
     */
    void deleteSpace(long id, User loginUser);

    /**
     *
     * @param id
     * @return
     */
    List<SpaceVO> getSpaceListByUserId(Long id);
}
